package cn.iocoder.yudao.module.shop.info.dal.mysql;

import cn.iocoder.yudao.framework.business.basic.dao.mapper.CoreMapper;
import cn.iocoder.yudao.framework.business.basic.dao.query.CoreLambdaQueryWrapper;
import cn.iocoder.yudao.framework.business.basic.dao.query.CoreQueryWrapper;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.shop.info.dal.dataobject.ShopEnterPackageDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 店铺入驻套餐 Mapper
 *
 * @author 山野羡民（1032694760@qq.com）
 */
@Mapper
public interface ShopEnterPackageMapper extends CoreMapper<ShopEnterPackageDO> {

    default PageResult<ShopEnterPackageDO> selectPage(PageParam reqVO) {
        return selectPage(reqVO, new CoreLambdaQueryWrapper<ShopEnterPackageDO>()
                .orderByAsc(ShopEnterPackageDO::getPrice));
    }

    default ShopEnterPackageDO selectOne() {
        CoreQueryWrapper<ShopEnterPackageDO> wrapper = new CoreQueryWrapper<>();
        wrapper.orderByAsc("price");
        wrapper.orderByDesc("id");
        wrapper.limitN(1);
        return selectOne(wrapper);
    }

}
